package com.xtwy.qrcodescan.zxing.decode;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.google.zxing.Result;
import com.xtwy.qrcodescan.zxing.ScanManager;
/*
 * -----------------------------------------------------------------
 * Copyright (C) 2014-2016, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * 文    件: PhotoScanHandler.java
 * 作    者: 侯建军
 * 版    权: 1.0.0
 * 描    述:  图像扫描处理
 * 创建时间: 2018/9/14 10:55
 * 更新时间：2018/9/14 10:55
 * -----------------------------------------------------------------
 * 2018/9/14 10:55 : 创建 PhotoScanHandler.java (侯建军);
 * -----------------------------------------------------------------
 */
public class PhotoScanHandler extends Handler{
	public final static int PHOTODECODEERROR=0;
	public final static int PHOTODECODEOK=1;
	ScanManager scanManager;
	public PhotoScanHandler(ScanManager scanManager) {
		this.scanManager=scanManager;
	}
	@Override
	public void handleMessage(Message message) {
		
		switch (message.what) {
		case PHOTODECODEERROR:
			scanManager.handleDecodeError((Exception)message.obj);
			break;
		case PHOTODECODEOK:
			Bundle bundle = message.getData();
			scanManager.handleDecode((Result) message.obj, bundle);
			break;
		default:
			break;
		}
	}
	
}
